const Koa = require('koa')
const app = new Koa()

// 计算中间件耗时的
const durationMiddleware = require('./middleware/duration')
app.use(durationMiddleware)

// 响应头中间件
const responseHeader = require('./middleware/response_header')
app.use(responseHeader)

// 返回数据的中间件
const responseData = require('./middleware/response_data')
app.use(responseData)

// 在8888端口启动服务
app.listen(8888)
console.log('project is starting at port 8888')

// 开启websocket服务并监听
const webSocketService = require('./service/websocket_service')
webSocketService.listen()
